Issue using Session in MVC Actions with [authorice]

Posted by Pablo Gonzalez on Stack Overflow See other posts from Stack Overflow or by Pablo Gonzalez
Published on 2010-06-07T17:30:23Z Indexed on 2010/06/07 17:32 UTC
Read the original article Hit count: 298

Filed under:
|

Hi all, first of all sorry for my poor English!

When I use the [Authorice` attribute i can't get Session data that i stored before. For example:

public ViewResult Index()
{
   // do some stuffs
   Session["Test"] = "Hi stackoverflow!";
}

And then i try to get it in another action, but with the [Authorize] attibute

[Authorize]
public ViewResult Test()
{
   // do some stuffs
   if(Session["Test"] == null) 
   { 
     //do some stuffs
   }
}

Session["Test"] is always null, but if i remove the attribute it's work, may anyone help me?, thanks a lot!!!

P.S: I instance Session["Test"] in Session_Start

© Stack Overflow or respective owner

Related posts about c#

Related posts about asp.net-mvc